<?php

namespace IDock\Insurance\ZSIC\Request;

use IDock\Insurance\ZSIC\Request\AllZSICRequest;
use IDock\Insurance\ZSIC\Response\VehicleModelResponse;
use IDock\Visitor\VehicleModelVisitor;

/**
 * 车型查询接口
 */
class VehicleModelRequest extends AllZSICRequest
{
    protected $response = VehicleModelResponse::class;

    protected $urlTip = '车辆车型查询';

    public $requestCode = 'carModelQuery';

    /**
     * @var VehicleModelVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $this->channelCode = $this->visitor->argc['channelCode'] ?? '';
        $this->cityCode = $this->visitor->argc['cityCode'] ?? '';

        $name = str_replace("牌",'',$this->visitor->vehicleModel);

        return [
            'vehicle' => [
                'licenseNo' => $this->visitor->licenseNo,
                'engineNo' => $this->visitor->engineNo,
                'frameNo' => $this->visitor->vin,
                'brandName' => $name,
            ]
        ];
    }

    public function getBusinessNo()
    {
        return $this->visitor->argc['businessNo'] ?? '';
    }
}
